home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 4 code / C++ Driver / iacDriver / TMessage.cp < prev    next >
Encoding:
Text File  |  1990-08-15  |  3.1 KB  |  99 lines  |  [TEXT/MPS ]

  1. // Copyright © 1990 Apple Computer, Inc. All rights reserved.
  2. #ifndef __IACHeaders__            // Every source file which uses the headers defined
  3. #include    "IACHeaders.h"            // In the main header file get the file included.  
  4. #endif
  5.  
  6. /**********************************Comment*****************************************
  7. * TMessage::TMessage is the constructor.  It simply sets up the data members based 
  8. * on what was passed in.  I felt there was no point in making a constructor that 
  9. * DIDN'T take these parameters as input because there'd be no reason to create an
  10. * TMessage object without them.
  11.  **********************************End Comment************************************/
  12. TMessage::TMessage(char *message, short senderSig, short receiverSig)
  13. {
  14. fSenderSig = senderSig;
  15. fReceiverSig = receiverSig;
  16. tseStrCpy((char *) &fMessageString, message);
  17. }
  18.  
  19. /**********************************Comment*****************************************
  20. * TMessage::~TMessage is the destructor.  It's just a place holder for the time being.
  21.  **********************************End Comment************************************/
  22. TMessage::~TMessage()
  23. {
  24. }
  25.  
  26.  
  27. // Public interfaces
  28.  
  29. /**********************************Comment*****************************************
  30. * TMessage::IsMessageForMe simply returns true or false, depending on whether the
  31. * signature of the intended receiver of the message matches the signature of the
  32. * requesting application.
  33.  **********************************End Comment************************************/
  34. Boolean
  35. TMessage::IsMessageForMe(short sigOfRequestor)
  36. {
  37. return ( this->GetReceiverSig() == sigOfRequestor );
  38. }
  39.  
  40. /**********************************Comment*****************************************
  41. * TMessage::IsMessageForMe returns true or false, depending on whether the
  42. * signature of the intended receiver of the message matches the signature of the
  43. * requesting application.  It also copies the message string into the buffer passed
  44. * in, and returns the signature of the application which sent the message.
  45.  **********************************End Comment************************************/
  46. Boolean
  47. TMessage::IsMessageForMe(short    sigOfRequestor, short *senderSig, char *messageString)
  48. {
  49. if ( this->GetReceiverSig() == sigOfRequestor )
  50.     {
  51.     *senderSig = this->GetSenderSig();
  52.     tseStrCpy(messageString,this->GetMessageString());
  53.     return(true);
  54.     }
  55. else
  56.     return (false);
  57. }
  58.  
  59. // Private interfaces
  60.  
  61. /**********************************Comment*****************************************
  62.  * These are all straight-foward, and probably could be in-lines (except for the last
  63.  * one which uses tseStrCpy).
  64.  **********************************End Comment************************************/
  65. short
  66. TMessage::GetSenderSig()
  67. {
  68. return (fSenderSig);
  69. }
  70.  
  71. short
  72. TMessage::GetReceiverSig()
  73. {
  74. return (fReceiverSig);
  75. }
  76.  
  77. char*
  78. TMessage::GetMessageString()
  79. {
  80. return ((char *) &fMessageString);
  81. }
  82.  
  83. void
  84. TMessage::SetSenderSig(short signature)
  85. {
  86. fSenderSig = signature;
  87. }
  88.  
  89. void
  90. TMessage::SetReceiverSig(short signature)
  91. {
  92. fReceiverSig = signature;
  93. }
  94.  
  95. void
  96. TMessage::SetMessageString(char *msgString)
  97. {
  98. tseStrCpy((char *) &fMessageString,msgString);
  99. }